<?php
namespace Framework\Middleware;
use Framework\Session;

class Authorise{
    public function isAuthorised(){
        return Session::has('user');
    }

    public function handle($role){
        if ($role === 'guest' && $this->isAuthorised()) {
            return redirect('/');
        }
        elseif($role === 'auth' && !$this->isAuthorised()){
            return redirect('/auth/login');
        }
    }
}